package com.company;

/**
 * @date : 2021-12-13 下午11:47
 * 栈溢出场景
 */

public class P012_StackOverFlow {

    public static class StackOverFlow {

        private static int stackLength = 1;

        public static void stackLeak() {
            stackLength++;
            stackLeak();
        }

        // VM Args：-Xss256k
        public static void main(String[] args) {
            try {
                stackLeak();
            } catch (Throwable e) {
                System.out.println("stack length:" + stackLength);
                throw e;
            }
        }
    }
}
